<script setup lang="ts">
import {PhoneFilled} from "@element-plus/icons-vue";
import { ref } from "vue";
import {useLogoTextStore} from "../stores/logoText.ts";

const useLogo = useLogoTextStore()
const Number = useLogo.getItemById(2)


const menuItems = ref({
  Shopping: [
    {
      name: '常見問題',
      path: '/message',
      query: {id: 3}
    },
    {
      name: '商品流程',
      path: '/message',
      query: {id: 4}
    },
    {
      name: '付款及運送說明',
      path: '/message',
      query: {id: 6}
    },
  ],
  Payment: [
    {
      name: '付款方式類型',
      path: '/message',
      query: {id: 7}
    },
  ],
  send: [
    {
      name: '順風速遞',
      path: '/message',
      query: {id: 10}
    },
    {
      name: '黑貓宅配',
      path: '/message',
      query: {id: 11}
    },
    {
      name: '郵局宅配',
      path: '/message',
      query: {id: 12}
    },
  ],
  AfterSales: [
    {
      name: '退換貨流程',
      path: '/message',
      query: {id:15}
    },
    {
      name: '7天鑑賞期',
      path: '/message',
      query: {id: 16}
    }
  ],
  ShoppingOverseas: [
    {
      name: '香港澳門',
      path: '/message',
      query: {id: 17}
    }
  ],
  Service: {
    name: '客服專線',
    Number: Number?.text,
    Week: '週一到週日10:00-22:00',
    path: '/message',
    query: {id: 21}
  }
});

const logoText = useLogo.getItemById(1)?.text
</script>


<template>
  <div class="site-footer">
    <div class="footer-container">
      <div class="col">
        <h4 class="title">購物指南</h4>
        <div class="menu-list">
          <router-link
            v-for="item in menuItems.Shopping"
            :key="item.path"
            :to="{path: item.path, query: item.query}"
            class="menu-link"
          >
            {{ item.name }}
          </router-link>
        </div>
      </div>

      <div class="col">
        <h3 class="title">付款方式</h3>
        <div class="menu-list">
          <router-link
            v-for="item in menuItems.Payment"
            :key="item.path"
            :to="{path: item.path, query: item.query}"
            class="menu-link"
          >
            {{ item.name }}
          </router-link>
        </div>
        <div class="col">
          <h4 class="title">海外購買</h4>
          <div class="menu-list">
            <router-link
                v-for="item in menuItems.ShoppingOverseas"
                :key="item.path"
                :to="{path: item.path, query: item.query}"
                class="menu-link"
            >
              {{ item.name }}
            </router-link>
          </div>
        </div>
      </div>

      <div class="col">
        <h3 class="title">寄送方式</h3>
        <div class="menu-list">
          <router-link
            v-for="item in menuItems.send"
            :key="item.path"
            :to="{path: item.path, query: item.query}"
            class="menu-link"
          >
            {{ item.name }}
          </router-link>
        </div>
      </div>

      <div class="col">
        <h3 class="title">售後服務</h3>
        <div class="menu-list">
          <router-link
            v-for="item in menuItems.AfterSales"
            :key="item.path"
            :to="{path: item.path, query: item.query}"
            class="menu-link"
          >
            {{ item.name }}
          </router-link>
        </div>
      </div>

      <div class="col" >

        <h3 >聯繫電話: {{ menuItems.Service.Number }}</h3>
        <p>{{ menuItems.Service.Week }}</p>
        <div class="menu-list">
          <router-link
              :to="{path: menuItems.Service.path, query: menuItems.Service.query}"
              class="menu-link"
          >
            <div class="button">
              <el-icon size="25px" color="#ecf0f1">
                <phone-filled/>
              </el-icon>
              <span >客服專線</span>
            </div>
          </router-link>
        </div>
      </div>
    </div>

    <div class="footer-divider"></div>

    <div class="copyright">© {{ new Date().getFullYear() }} {{ logoText }} 版權所有，並保留所有權利</div>
  </div>
</template>

<style scoped>
.site-footer {
  background: linear-gradient(135deg, #1a252f 0%, #2c3e50 100%);
  color: #ecf0f1;
  padding: 48px 0 32px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.button{
  background: #85c143;
  border-radius: 6px;
  padding: 8px 18px;
  display: flex;
}

.button span {
  font-weight: bold;
  font-size: 22px;
  color: white;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-size: 200% 100%;
  animation: gradient-shift 3s ease-in-out infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0 50%; }
  50% { background-position: 100% 50%; }
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 40px;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.title {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  position: relative;
  padding-bottom: 12px;
}

.title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, #46ab3f, #7df9a2);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.col:hover .title::after {
  width: 60px;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-link {
  color: #bdc3c7;
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: all 0.3s ease;
  position: relative;
  padding: 4px 0;
}

.menu-link::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  width: 0;
  height: 2px;
  background: #0f7f00;
  transform: translateY(-50%);
  transition: width 0.3s ease;
}

.menu-link:hover {
  color: #ffffff;
  transform: translateX(8px);
}

.menu-link:hover::before {
  width: 6px;
}

.footer-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  margin: 32px 0 0;
}

.copyright {
  width: 100%;
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 400;
  letter-spacing: 1px;
  margin: 24px 0 0;
}

@media (max-width: 1200px) {
  .footer-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
  }
}

@media (max-width: 992px) {
  .footer-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
  }
}

@media (max-width: 768px) {
  .site-footer {
    padding: 0 0 24px;
  }

  .footer-container {
    grid-template-columns: 1fr !important;
    gap: 16px;
    padding: 0 16px;
  }

  .footer-container > .col:not(:last-child) {
    display: none;
  }

  .col {
    align-items: center;
    text-align: center;
  }

  .button {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
  }

  .footer-divider {
    margin: 24px 0 0;
  }

  .copyright {
    padding: 0 12px;
    word-break: keep-all;
  }
}

@media (max-width: 480px) {
  .footer-container {
    grid-template-columns: 1fr !important;
    padding: 0 14px;
  }

  .footer-container > .col:not(:last-child) {
    display: none;
  }

  .title {
    font-size: 15px;
  }

  .menu-link {
    font-size: 12px;
  }
}
</style>
